package com.agile.leetcode.jvm.oom;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author chenzhangkun
 * @ClassName OOMDoubleThreadTest
 * @description: 一个线程会暂停运行，另外的线程不会影响
 * @date 2025年07月31日
 */
public class OOMDoubleThreadTest {
    public static void main(String[] args) {
        new Thread(() -> {
            List<byte[]> list = new ArrayList<byte[]>();
            for (;;) {
                System.out.println(new Date().toString() + " OOM Thread is running!!!");
                byte[] b = new byte[1024 * 1024 * 1];
                list.add(b);
            }
        }).start();

        new Thread(() -> {
            for (;;) {
                System.out.println(new Date().toString() + " Other Thread is running!!!");
            }
        }).start();
    }
}
